﻿/***************************************************************
 * 开发人员：网魂小兵@http://www.mozlite.com
 * 
 * 目标标本：4.0.30319.239
 * 
 * 最后修改：2011/12/18 9:50:17
 * ************************************************************/
namespace Mozlite.Web.UI
{
    using System;
    using System.Linq;
    using System.Text;
    using System.Collections.Generic;
    using System.Web.Routing;
    using System.Web.Mvc;
    using Mozlite.Common;

    /// <summary>
    /// 静态扩展方法类。
    /// </summary>
    public static class WowUtility
    {
        /// <summary>
        /// 本模板名称WOW。
        /// </summary>
        public static readonly string ThemeName = "Wow";
        /// <summary>
        /// 添加模板名称前缀。
        /// </summary>
        /// <param name="name">名称。</param>
        /// <returns>返回添加后的字符串。</returns>
        public static string AppendThemeName(this string name) {
            return ThemeName + "." + name;
        }

        /// <summary>
        /// 注册路由。
        /// </summary>
        /// <param name="routes">路由集合。</param>
        /// <param name="name">名称，唯一</param>
        /// <param name="url">Url地址。</param>
        /// <param name="defaults">默认值。</param>
        /// <param name="constraints">正则表达式。</param>
        internal static void RegisterUrl(this RouteCollection routes, string name, string url = null, object defaults = null, object constraints = null)
        {
            routes.Register(name.AppendThemeName(), url, defaults, constraints, new[] { "Mozlite.Web.UI.Themes.Wow.*" });
        }
    }
}